﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Modules_Module_BBS_List : System.Web.UI.UserControl
{
    protected int AddBBSRecord(string name,string title,string content,string parent)
    {
        string btime;
        btime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
        string strSQL;
        strSQL = "INSERT INTO bbs(username,title,content,parent,time) VALUES (";
        strSQL += "'" + name + "'";
        strSQL += ",'" + title + "'";
        strSQL += ",'" + content + "'";
        strSQL += ",'" + parent + "'";
        strSQL += ",'" + btime + "')";
        MysqlHelp MHBBSNew = new MysqlHelp();
       int result = MHBBSNew.Runsql(strSQL);
       return result;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void submit_Click(object sender, EventArgs e)
    {
        string name,titile, content;
        name = "lijiabin";
        titile = this.TextBox_title.Text.Trim();
        content = this.TextBox_content.Text.Trim();
        if(!string.IsNullOrEmpty(titile)&&!string.IsNullOrEmpty(content))
        {
            AddBBSRecord(name, titile, content, "0");
            Response.Write("<script language=javascript>alert('恭喜您，发帖成功！');</script>");
        }
        this.TextBox_title.Text = string.Empty;
        this.TextBox_content.Text = string.Empty;
        Response.AddHeader("Refresh", "0");
    }
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
       // this.GridView1.Columns[4].Visible = true;
    }
}
